<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Users extends MX_Controller {
    
    private $_data = array();
    function __construct(){
        parent::__construct();
    }
    // index == login function
    function index(){       
        $this->load->library('captcha');
        
        $this->template->add_js('assets/scripts/users/login.js');
        $data = array();
        $this->template->parse_view('content' , 'users/login', $data);
        $this->template->render();        
    }
    
    public function register(){
        $this->template->add_js('assets/scripts/users/login.js');
        $data = array();
        $this->template->parse_view('content' , 'users/signup', $data);
        $this->template->render();        
    }
    
    public function create(){ 
        if($_SERVER['REQUEST_METHOD'] == 'POST'){ 
            //die(print_r($this->input->post));
            $name_error = array();
            array_push($name_error, array('field' => 'email' , 'ngshow' => 'havemail'));
            array_push($name_error, array('field' => 'name' , 'ngshow' => 'required'));
            $json['success'] = FALSE;
            $json['message'] = 'Gửi không thành công.';
            $json['name_error'] = $name_error; 
            echo json_encode($json);  
            return; 
        }
    }
    
    public function captcha(){
        $this->load->library('captcha');
        $captcha = new Captcha();
        $captcha->chars_number = 4;
        $captcha->font_size = 15; 
        $captcha->tt_font = 'assets/fonts/Roboto-Bold.ttf'; 
        //$_SESSION['security_code']; 
        //$_SESSION['security_code']; 
        $captcha->show_image(75, 29);
    }
    function Logout(){
        
    }
    function UpdateInfo(){
        
    }
    function ChangePassword(){
        
    }
    function ForgotPassword(){
        
    }
    
    
    /**
     * 
     * section call ajax
     * 
     */
    
/* ==================================

    END CLASS
    
===================================== */
}